<?php

 
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

class TableTicketdata extends HelpDeskTable 
{
	var $id		 	= null;
	var $ticketid 	= null;
	
	function TableTicketdata( &$db ) 
	{
		parent::__construct( '#__helpdesk_ticketdata', 'ticketid', $db );

		$fields = $db->getTableFields( '#__helpdesk_ticketdata', true );
		$keys = array_keys( $fields['#__helpdesk_ticketdata'] );
		for ($i=0; $i<count($keys); $i++) {
			$field = $keys[$i];
			$this->$field = null;
		}
	}   

	function store( $updateNulls = true) {
		$k = 'id';
 
        if( $this->$k)
        {
            $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls );
        }
        else
        {
            $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key );
        }
        if( !$ret )
        {
            $this->setError(get_class( $this ).'::store failed - '.$this->_db->getErrorMsg());
            return false;
        }
        else
        {
            return true;
        }
	}	
	
}